// pages/impredra/impredra_detail.js
var app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    index:1,
    hidecode: true,
    showcode: false,
    distate: false,
    thesid: '',
    card: '获取验证码',
    mobile:'',
    landing_page:'',
    userimg:true,
    username:true
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var id =options.id
    console.log('获取来的id是',id)
    var query = wx.createSelectorQuery();
    query.select('#detail').boundingClientRect()
    query.exec(function (res) {
      //res就是 所有标签为mjltest的元素的信息 的数组
      //console.log(res);
      //取高度
      var height = res[0].height * 5 + 500
      //console.log(res[0].height);
      that.setData({
        winHeight: height
      })
    })
    wx.request({
      url: app.apiUrl('c=rendering/index&a=getdetail'),
      data: { renderingID:id},
      header: {
        'content-type': 'application/json' // 默认值
      },
      success: function (res) {
        var polist = res.data.data
        var imgth = polist.ablum.length
        var userimg = polist.avatar
        var username = polist.designerName
        console.log(polist)
        if((userimg ==null)||(username==null)){
          that.setData({
            polistde: polist,
            imglen: imgth,
            userimg: false,
            username: false
          })
        }else{
          that.setData({
            polistde: polist,
            imglen: imgth,
            userimg: true,
            username: true
          })
        }
       
      }
    })
 
  },
 
  bindchange:function(e){
    var that = this
    var index = e.detail.current
    that.setData({
      index: e.detail.current + 1
    })
  },
  findesigner:function(){
    wx.navigateTo({
      url: "../index/free/free_design"
    })
  },
})